package cn.hyy.FVOnline.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import cn.hyy.FVOnline.entity.Evaluate;

import java.util.List;

@Repository("evaluateMapper")
public interface EvaluateMapper {


    @Select("select * from evaluate where gid = #{gid}")
    List<Evaluate> findByGid(@Param("gid") Integer gid);

    @Insert("insert into evaluate (evaluate,uid,gid,time) values(#{evaluate.evaluate}," +
            "#{evaluate.uid},#{evaluate.gid},#{evaluate.time})")
    void saveEvaluate(@Param("evaluate") Evaluate evaluate);

    @Select("select * from evaluate where evaluate like #{what} limit #{start}, #{pageSize}")
    List<Evaluate> getEvaluate(@Param("what") String what,@Param("start") Integer start,@Param("pageSize") Integer pageSize);

    @Select("select count(*) from evaluate where evaluate like #{what}")
    Integer getEvaluateTotal(@Param("what") String what);

    @Delete("delete from evaluate where id = #{id}")
    void delEvaluate(@Param("id") Integer id);
}
